/**
 * 多选组件
 */
(function(window, angular, undefined){

	var component = angular.module('water.common.component.comDialog',[]);
	
	/**
	 * 基础弹框组件
	 */
	component.directive("comDialog", function() {
		return {
		    restrict: "A",     
		    require : "ngModel",
		    scope: {              // 设置指令对于的scope 
		      finish:"&ngFinish",
		      height:"@",
		      width:"@",
		      title:"@",
		      cc:"&cc",
		      model:'=ngModel'
		    },
		    controller: [ "$scope", function ($scope) {
		    	
		    }], 
		    link:function($scope, elm, attrs, controller){
		    	elm.window({
		    		title:$scope.title,
					height:$scope.height,
					width:$scope.width,
					modal:true,
					closed:true,
					minimizable:false,
					collapsible:false,
					shadow:true,
					maximizable:false
		    	});
		    	$scope.elm = elm;
		    	$scope.model = {
		    			open : function(){
				    		$scope.elm.window('open');
				    	},
				    	close : function(){
				    		$scope.elm.window('close');
				    	},
				    	elm:elm
		    	};
		    	
		    	controller.$render = function(){
		    		controller.$setViewValue($scope.model);
		    	}
	        }
		 } 
	});
	
}(window, angular));